package ys.ewp.dto;

import java.util.Date;
import ys.ewp.po.Notice;

public class NoticeDto {
	
	//公告ID
	private Integer id;
	//公告标题
	private String title;
	//公告内容
	private String content;
	//是否可评论
	private boolean mayComment;
	//格式化的创建日期
	private String formatDateCreated;
	//所属栏目ID
	private Integer colId;
	//所属栏目名称
	private String colTitle;
	//所属用户ID
	private Integer empId;
	//所属员工姓名
	private String empRealName;
	//创建时间
	private Date dateCreated;
	//更新时间
	private Date dateUpdated;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public boolean isMayComment() {
		return mayComment;
	}
	public void setMayComment(boolean mayComment) {
		this.mayComment = mayComment;
	}
	public String getFormatDateCreated() {
		return formatDateCreated;
	}
	public void setFormatDateCreated(String formatDateCreated) {
		this.formatDateCreated = formatDateCreated;
	}
	public Integer getColId() {
		return colId;
	}
	public void setColId(Integer colId) {
		this.colId = colId;
	}
	public String getColTitle() {
		return colTitle;
	}
	public void setColTitle(String colTitle) {
		this.colTitle = colTitle;
	}
	public Integer getEmpId() {
		return empId;
	}
	public void setEmpId(Integer empId) {
		this.empId = empId;
	}
	public String getEmpRealName() {
		return empRealName;
	}
	public void setEmpRealName(String empRealName) {
		this.empRealName = empRealName;
	}
	public Date getDateCreated() {
		return dateCreated;
	}
	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}
	public Date getDateUpdated() {
		return dateUpdated;
	}
	public void setDateUpdated(Date dateUpdated) {
		this.dateUpdated = dateUpdated;
	}
	
	/**
	 * @功能 根据公告PO对象获得公告DTO对象
	 */
	public static NoticeDto getDtoByPo(Notice not){
		NoticeDto notDto = new NoticeDto();
		
		notDto.setId(not.getId());
		notDto.setTitle(not.getTitle());
		notDto.setContent(not.getContent());
		notDto.setMayComment(not.isMayComment());
		notDto.setFormatDateCreated(not.getFormatDateCreated());
		notDto.setColId(not.getColumn().getId());
		notDto.setColTitle(not.getColumn().getTitle());
		notDto.setEmpId(not.getEmployee().getId());
		notDto.setEmpRealName(not.getEmployee().getRealName());
		notDto.setDateCreated(not.getDateCreated());
		notDto.setDateUpdated(not.getDateUpdated());
		
		return notDto;
	}
	
	/**
	 * @功能 根据公告DTO对象获得公告PO对象
	 */
	public static Notice getPoByDto(NoticeDto notDto){
		Notice not = new Notice();
		
		not.setTitle(notDto.getTitle());
		not.setContent(notDto.getContent());
		not.setMayComment(notDto.isMayComment());
		not.setFormatDateCreated(notDto.getFormatDateCreated());
		//not.setColumn(col);
		//not.setEmployee(emp);
		not.setDateCreated(notDto.getDateCreated());
		not.setDateUpdated(notDto.getDateUpdated());
		
		return not;
	}
	
}
